trigger NATOOppUpdateRestrictToProfileTrigger on Opportunity (before update)
    {
    String Nationalsales,NatSaleAssignmentMgr,NatSaleMgr,NatSaleOperation,NatSaleReadOnly;
    String contractRecId=RecordTypeHelper.GetRecordTypeID('Opportunity', 'Contract');
    List<Profile> Lstprof=[Select Name,Id From Profile];
    Id profileId=UserInfo.getProfileId();
    for(Profile prof:Lstprof)
        {
          if(prof.Name=='National Sales')
          Nationalsales= prof.Id;
          if(prof.Name=='National Sales Assignment Manager')
          NatSaleAssignmentMgr=prof.Id;
          if(prof.Name=='National Sales Management')
          NatSaleMgr=prof.Id;
          if(prof.Name=='National Sales Operations')
          NatSaleOperation=prof.Id;
          if(prof.Name=='National Sales Read Only')
          NatSaleReadOnly=prof.Id;
        }
        for(Opportunity opp:trigger.new)
        {
        if(opp.recordTypeId==contractRecId && ((opp.Approval_Discount__c>30 && opp.Approval_Product__c=='IYP')||(opp.Approval_Discount__c>60 && opp.Approval_Product__c=='PRINT'))
	&& opp.stageName=='Sold' && opp.Approval_Discount__c>30 && opp.Approval_Received__c==False && (profileId==Nationalsales || 
        profileId==NatSaleAssignmentMgr || profileId==NatSaleMgr || profileId==NatSaleOperation || profileId==NatSaleReadOnly))
        {
        opp.adderror('Please submit this opportunity for an approval before changing the Opportunity Stage to Sold');
        }
    }
}